package service.impl;

import dao.UserDao02;
import dao.impl.UserDaoImpl02;
import pojo.User;
import service.UserService02;

public class UserServiceImpl02 implements UserService02 {
    private UserDao02 userDao02 = new UserDaoImpl02();

    @Override
    public void regist(User user) {
        userDao02.saveUser(user);
    }

    @Override
    public User login(User user) {
        return userDao02.queryForUsernameAndPassword(user.getUsername(), user.getPassword());
    }

    @Override
    public boolean existsUser(String username) {
        if (userDao02.queryForUsername(username) == null)
            return false;
        return true;
    }
}
